package com.telsoft.hms.function;

import java.util.List;

import com.telsoft.hms.data.HMS_OrderServiceDTL_DATA;
import com.telsoft.hms.entity.ETT_OrderServiceDTL;
import com.telsoft.hms.lib.security.session.Session;
import com.telsoft.hms.util.SessionUtil;

public class HMS_OrderServicesDTL {
	private final HMS_OrderServiceDTL_DATA orderServiceDTLData;
	
	public HMS_OrderServicesDTL() {
		orderServiceDTLData = new HMS_OrderServiceDTL_DATA();
	}
	/**
	 * Hủy yêu cầu dịch vụ
	 * 
	 * @author MinhTQ
	 * @param strSecurityKey
	 *            Mã bảo mật
	 * @param objOSDTL
	 *            đối tượng order service detail
	 * @throws Exception
	 *             Ngày tạo: 09/10/2014
	 */
	public boolean deleteOrderServiceDTL(String strSecurityKey, ETT_OrderServiceDTL objOSDTL) throws Exception {				
		Session session;
		try {
			session = SessionUtil.getSession(strSecurityKey);
		} catch (Exception ex) {
			throw ex;
		}
		if(objOSDTL.getStatus()==2){
			throw new Exception("ERR-0099");// Loi dich vu da thuc hien khong huy duoc
		}
		if (objOSDTL.getOrderServiceDTLId() <= 0) {
			throw new Exception("ERR-0100");// Loi id yeu cau chi tiet dich vu khong co
		}
		return orderServiceDTLData.deleteOrderServiceDTL(session.getHospitalKey(), objOSDTL);
		
	}
}
